<template>
  <div class="page-wrapper">
    <MHeader :type="type"></MHeader>
    <div class="content-box">
      <div class="content-lf" :class="{'collapse':collapse1}">
        <i class="collapse-btn" @click="changeCollapse1"></i>
        <AlarmStatistics></AlarmStatistics>
        <TimeDependentAnalysis></TimeDependentAnalysis>
        <AlarmFrequencyAnalysis></AlarmFrequencyAnalysis>
      </div>
      <div class="content-center">
        <MapBox :type="type"></MapBox>
      </div>
      <div class="content-rt" :class="{'collapse':collapse2}">
        <i class="collapse-btn" @click="changeCollapse2"></i>
        <Alarm :type="type"></Alarm>
        <RealtimeAlarm :type="type"></RealtimeAlarm>
        <NavigationalStatus></NavigationalStatus>
      </div>
    </div>
  </div>

</template>

<script>
// test
import MHeader from './components/m-header/m-header'
import AlarmStatistics from './components/alarm-statistics/alarm-statistics'
import NavigationalStatus from './components/navigational-status/navigational-status'
import AlarmFrequencyAnalysis from './components/alarm-frequency-analysis/alarm-frequency-analysis'

import Alarm from './components/alarm/alarm'
import RealtimeAlarm from './components/realtime-alarm/realtime-alarm'
import TimeDependentAnalysis from './components/time-dependent-analysis/time-dependent-analysis'

import MapBox from './components/map-box/map-box'
import { mapState, mapActions } from 'vuex'

export default {
  components: {
    MHeader,
    AlarmStatistics,
    NavigationalStatus,
    AlarmFrequencyAnalysis,
    Alarm,
    RealtimeAlarm,
    TimeDependentAnalysis,
    MapBox
  },
  data() {
    return {
      type: 'jianguan'
    }
  },
  computed: {
    ...mapState('bigScreen', [
      'collapse1',
      'collapse2',
    ])
  },
  methods: {
    changeCollapse1() {
      this.setCollapse1(!this.collapse1)
    },
    changeCollapse2() {
      this.setCollapse2(!this.collapse2)
    },
    ...mapActions('bigScreen', [
      'setCollapse1',
      'setCollapse2'
    ])
  }
}
</script>

<style scoped lang="scss">
@import "./styles/collapse";
.page-wrapper {
  width: 1920px;
  height: 1080px;
  //background: url("./images/bg.png") no-repeat center;
  //background-size: 100% 100%;
  background: #000;
  position: relative;
  margin: auto;
  .content-box {
    position: absolute;
    top: 23 + 65px;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    .content-lf {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      position: absolute;
      top: 0;
      left: 0;
      width: $width + px;
      background: #000;
      height: 100%;
      z-index: 10;
      padding: 0 20px;
      > .collapse-btn {
        left: 100%;
      }
      transition: $transition1;
      &.collapse {
        left: 0 - $width + px;
      }
    }
    .content-rt {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      position: absolute;
      top: 0;
      right: 0;
      width: $width + px;
      background: #000;
      height: 100%;
      z-index: 10;
      padding: 0 20px;
      > .collapse-btn {
        right: 100%;
        transform: translate(0, -50%) rotateY(180deg);
      }
      transition: $transition2;
      &.collapse {
        right: 0 - $width + px;
      }
    }
    .content-center {
      width: 100%;
      height: 100%;
    }
  }
}
.collapse-btn {
  display: block;
  width: 12px;
  height: 108px;
  background: url("./images/collapse.png") no-repeat center;
  background-size: 100% 100%;
  position: absolute;
  top: 50%;
  transform: translate(0, -50%);
  cursor: pointer;
}
</style>
